package com.yanqu.road.server.manger.config.grandchild.talent.effect;

import com.yanqu.road.server.manger.config.grandchild.talent.entity.TalentTriggerSkillParam;
import com.yanqu.road.server.manger.config.grandchild.talent.entity.TalentTriggerSkillResult;
import com.yanqu.road.server.manger.config.grandchild.talent.entity.TalentTriggerSkillResultBuilder;
import com.yanqu.road.utils.RandomHelper;

public class SkillEffect105 implements ISkillEffect {

    @Override
    public TalentTriggerSkillResult getResult(TalentTriggerSkillParam param) {
        int value = 0;
        Integer weight = param.getSkillInfo().getParamList().get(2);
        boolean isActive = false;
        long randomValue = RandomHelper.nextLong(1000);
        if (randomValue < weight) {
            value = param.getSkillInfo().getParamList().get(1);
            isActive = true;
        }
        return TalentTriggerSkillResultBuilder.aTalentTriggerSkillResult().setEarnSpeedAddition(value).setActive(isActive).build();
    }

}
